package cn.kgc.springcloud.controller;

import cn.kgc.springcloud.entity.City;
import cn.kgc.springcloud.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/2/27
 * @Description:
 */
@RestController
@RequestMapping("citys")
public class CityController {

    @Autowired
    private CityService cityService;

    @GetMapping
    public List<City> getList(){
        return cityService.list();
    }


    @PostMapping
    public City addCity(@RequestBody City city){
        return cityService.addCity(city);
    }


}
